package com.milo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author Milo Lee
 * @date 2021-05-24 16:13
 */
public class APP {

    static class School{
        private String name;
        private String address;
        private String tel;
        private List<Banji> banlist;

        public School(String name, String address, String tel) {
            this.name = name;
            this.address = address;
            this.tel = tel;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getTel() {
            return tel;
        }

        public void setTel(String tel) {
            this.tel = tel;
        }

        public void setBanlist(List<Banji> banlist) {
            this.banlist = banlist;
        }

        public List<Banji> getBanlist() {
            return banlist;
        }
    }

    static class Banji{
        private String a;
        private String b;
        private String c;
        private List<Student> studengList;

        public Banji(String a, String b, String c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public void setStudentlist(List<Student> stlist1) {
            this.studengList = stlist1;
        }

        public List<Student> getStudentlist() {
            return studengList;
        }
    }

    static class Student{
        private String a;
        private int b;
        private String c;
        private int d;

        public Student(String a, int b, String c, int d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }

        public  int getsex() {
            return b;
        }
    }

    public static void main(String[] args) {
        School school=new School("龙岗五联","深圳技师学院","123456789");
        Banji class1=new Banji("1班","20180901","20220901");
        Banji class2=new Banji("2班","20180901","20220901");
        Banji class3=new Banji("3班","20180901","20220901");
        Student s1=new Student("学生1",1,"123456789",18);
        Student s2=new Student("学生2",1,"2457878989",18);
        Student s3=new Student("学生3",1,"5678456543",18);
        Student s4=new Student("学生4",2,"10086666666",18);
        Student s5=new Student("学生5",1,"24578654689",18);
        Student s6=new Student("学生6",2,"12589468467",18);
        Student s7=new Student("学生7",1,"13854268765",18);
        Student s8=new Student("学生8",2,"13864568745",18);
        Student s9=new Student("学生9",1,"15886478687",18);
        Student s10=new Student("学生10",2,"7568745687",18);

        ArrayList<Banji> teamplist = new ArrayList<Banji>();
        teamplist.add(class1);
        teamplist.add(class2);
        teamplist.add(class3);
        school.setBanlist(teamplist);


        ArrayList<Student> stlist1 = new ArrayList<Student>();
        stlist1.add(s1);
        stlist1.add(s2);
        stlist1.add(s3);
        class1.setStudentlist(stlist1);

        ArrayList<Student> stlist2 = new ArrayList<Student>();
        stlist2.add(s4);
        stlist2.add(s5);
        stlist2.add(s6);
        class2.setStudentlist(stlist2);

        ArrayList<Student> stlist3 = new ArrayList<Student>();
        stlist3.add(s7);
        stlist3.add(s8);
        stlist3.add(s9);
        stlist3.add(s10);
        class3.setStudentlist(stlist3);

        //统计数据
        //学生总人数
        int qbrs = 0;
        //男生总数
        int boyTotal = 0;
        //女生总数
        int girlTotal = 0;
        for (int i=0;i<school.getBanlist().size();i++){
            Banji c1= school.getBanlist().get(i);
            qbrs+=c1.getStudentlist().size();
            List<Student> students = c1.getStudentlist();
            for (int j = 0; j < students.size(); j++) {
               Student s =  students.get(j);
                if (s.getsex() == 1) {
                    boyTotal++;
                } else {
                    girlTotal++;
                }
            }
            //获取班级下面的学生

        }


        System.out.println("学校名是："+school.getName()+"" +
                "地址是"+school.getAddress()+"" +
                "电话是："+school.getTel()+"" +
                "有"+qbrs+"名学生,男生有:"+boyTotal+"人,女生有:"+girlTotal+"人;");
    }
}
